package com.jiukuaidao.library.widget.banner.holder.impl;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.jiukuaidao.library.R;
import com.jiukuaidao.library.widget.banner.holder.Holder;


/**
 * 网络加载图片
 */
public class NetworkImageHolderView implements Holder<String> {
    private ImageView mBannerImg;

    @Override
    public View createView(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.banner_layout, null);
        mBannerImg = (ImageView) view.findViewById(R.id.bannerImg);
        return view;
    }

    @Override
    public void showImg(Context context, int position, String data, int defaultImg) {
        Glide.with(context).load(data).into(mBannerImg);
    }

    @Override
    public void showDefaultImg(int defaultImg) {
        mBannerImg.setImageResource(defaultImg);
    }
}
